package com.qfedu.luck.service.impl;

import com.qfedu.luck.dao.UserDao;
import com.qfedu.luck.dao.impl.UserDaoImpl;
import com.qfedu.luck.entity.User;
import com.qfedu.luck.service.UserService;
import com.qfedu.luck.vo.R;

/**
 * @program: LuckStudy
 * @description:
 * @author: Feri(邢朋辉)
 * @create: 2021-02-24 14:58
 */
public class UserServiceImpl implements UserService {
    private UserDao dao=new UserDaoImpl();
    @Override
    public R add(User user) {
        if(user!=null){
            if(user.getPhone()!=null && user.getPwd()!=null){
                if(dao.selectByPhone(user.getPhone())==null){
                    if(dao.insert(user)>0){
                        return R.ok(null);
                    }
                }
            }
        }
        return R.fail();
    }
}
